<HTML>
<HEAD>
<TITLE>[Chapter 23] ListPeer</TITLE>
<META NAME="author" CONTENT="John Zukowski">
<META NAME="date" CONTENT="Thu Jul 31 15:28:27 1997">
<META NAME="form" CONTENT="html">
<META NAME="metadata" CONTENT="dublincore.0.1">
<META NAME="objecttype" CONTENT="book part">
<META NAME="otheragent" CONTENT="gmat dbtohtml">
<META NAME="publisher" CONTENT="O'Reilly &amp; Associates, Inc.">
<META NAME="source" CONTENT="SGML">
<META NAME="subject" CONTENT="Java AWT">
<META NAME="title" CONTENT="Java AWT">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
</HEAD>
<body vlink="#551a8b" alink="#ff0000" text="#000000" bgcolor="#FFFFFF" link="#0000ee">

<DIV CLASS=htmlnav>
<H1><a href='index.htm'><IMG SRC="gifs/smbanner.gif"
     ALT="Java AWT" border=0></a></H1>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch23_13.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><B><FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1">Chapter 23<br>java.awt.peer Reference</FONT></B></TD>
<td width=172 align=right valign=top><A HREF="ch23_15.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
</table>

&nbsp;
<hr align=left width=515>
</DIV>
<DIV CLASS=refnamediv>
<H1>ListPeer</H1>

<H2>Name</H2>

ListPeer

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch23-REFSECT1-AUTOID.63"></A></h2>
</DIV>


<p>
<img align=middle src="./figs/listpee.gif" alt="[Graphic: Figure from the text]" width=502 height=82 border=0>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch23-REFSECT1-AUTOID.64">Description</A></h2>

<P CLASS=para>
<tt CLASS=literal>ListPeer</tt> is an interface that 
defines the basis for list components. 

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch23-REFSECT1-AUTOID.65">Interface Definition</A></h2>

<DIV CLASS=screen>
<P>
<PRE>
public abstract interface java.awt.peer.ListPeer
   extends java.awt.peer.ComponentPeer {
  // Interface Methods
  public abstract void add (String item, int index); <img src="gifs/bstar.gif" alt="(New)" border=0>
  public abstract void addItem (String item, int index); <img src="gifs/wstar.gif" alt="(Deprecated)" border=0>
  public abstract void clear(); <img src="gifs/wstar.gif" alt="(Deprecated)" border=0>
  public abstract void delItems (int start, int end);
  public abstract void deselect (int index);
  public abstract Dimension getMinimumSize (int rows); <img src="gifs/bstar.gif" alt="(New)" border=0>
  public abstract Dimension getPreferredSize (int rows); <img src="gifs/bstar.gif" alt="(New)" border=0>
  public abstract int[] getSelectedIndexes();
  public abstract void makeVisible (int index);
  public abstract Dimension minimumSize (int rows); <img src="gifs/wstar.gif" alt="(Deprecated)" border=0>
  public abstract Dimension preferredSize (int rows); <img src="gifs/wstar.gif" alt="(Deprecated)" border=0>
  public abstract void removeAll(); <img src="gifs/bstar.gif" alt="(New)" border=0>
  public abstract void select (int position);
  public abstract void setMultipleMode (boolean b); <img src="gifs/bstar.gif" alt="(New)" border=0>
  public abstract void setMultipleSelections (boolean value); <img src="gifs/wstar.gif" alt="(Deprecated)" border=0>
}
</PRE>
</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch23-REFSECT1-AUTOID.66">Interface Methods</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.56">add</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.57">public abstract void add (String item, int index) <img src="gifs/bstar.gif" alt="(New)" border=0></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>item</I><br>
<DD>

<P CLASS=para>
Text of an entry to 
add to the list.

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>index</I><br>
<DD>

<P CLASS=para>
Position in which 
to add the entry; position 0 is the first entry in the list. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Adds a new entry to the available choices of the list's peer at the 
designated position. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.57">addItem</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.58">public abstract void addItem (String item, int index) <img src="gifs/wstar.gif" alt="(Deprecated)" border=0></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>item</I><br>
<DD>

<P CLASS=para>
Text of an entry to 
add to the list.

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>index</I><br>
<DD>

<P CLASS=para>
Position in which 
to add the entry; position 0 is the first entry in the list. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Adds a new entry to the available choices of the list's peer at the 
designated position. Replaced by <tt CLASS=literal>add(String, int)</tt>. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.58">clear</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.59">public abstract void clear() <img src="gifs/wstar.gif" alt="(Deprecated)" border=0></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Clears all the entries out of the list's peer. Replaced by <tt CLASS=literal>removeAll()</tt>. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.59">delItems</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.60">public abstract void delItems (int start, int end)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>start</I><br>
<DD>

<P CLASS=para>
Starting position 
of entries to delete.

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>end</I><br>
<DD>

<P CLASS=para>
Ending position of 
entries to delete. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Removes a set of entries from the list's peer. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.60">deselect</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.61">public abstract void deselect (int index)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>index</I><br>
<DD>

<P CLASS=para>
Position to deselect. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Deselects entry at designated position, if selected. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.61">getMinimumSize</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.62">public abstract Dimension getMinimumSize (int rows) <img src="gifs/bstar.gif" alt="(New)" border=0></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>rows</I><br>
<DD>

<P CLASS=para>
Number of rows within 
list's peer to size. </DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The minimum dimensions of a list's peer of the given size. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.62">getPreferredSize</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.63">public abstract Dimension getPreferredSize (int rows) <img src="gifs/bstar.gif" alt="(New)" border=0></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>rows</I><br>
<DD>

<P CLASS=para>
Number of rows within 
list's peer to size. </DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The preferred dimensions of a list's peer of the given size. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.63">getSelectedIndexes</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.64">public abstract int[] getSelectedIndexes()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
Array of positions of currently selected entries in list's peer. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.64">makeVisible</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.65">public abstract void makeVisible (int index)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>index</I><br>
<DD>

<P CLASS=para>
Position to make 
visible on screen. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Ensures an item is displayed on the screen in the list's peer. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.65">minimumSize</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.66">public abstract Dimension minimumSize (int rows) <img src="gifs/wstar.gif" alt="(Deprecated)" border=0></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>rows</I><br>
<DD>

<P CLASS=para>
Number of rows within 
list's peer to size. </DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The minimum dimensions of a list's peer of the given size. Replaced 
by <tt CLASS=literal>getMinimumSize(int)</tt>. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.66">preferredSize</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.67">public abstract Dimension preferredSize (int rows) <img src="gifs/wstar.gif" alt="(Deprecated)" border=0></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>rows</I><br>
<DD>

<P CLASS=para>
Number of rows within 
list's peer to size. </DL>
<p>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The preferred dimensions of a list's peer of the given size. Replaced 
by <tt CLASS=literal>getPreferredSize(int)</tt>. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.67">removeAll</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.68">public abstract void removeAll() <img src="gifs/bstar.gif" alt="(New)" border=0></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Clears all the entries out of the list's peer. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.68">select</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.69">public abstract void select (int position)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>position</I><br>
<DD>

<P CLASS=para>
Position to select; 
0 indicates the first item in the list. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Makes the given entry the selected item for the list's peer; deselects 
other selected entries if multiple selections are not enabled. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.69">setMultipleMode</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.70">public abstract void setMultipleMode (boolean value) <img src="gifs/bstar.gif" alt="(New)" border=0></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>value</I><br>
<DD>

<P CLASS=para>
<tt CLASS=literal>true</tt> 
to allow multiple selections within the list's peer; <tt CLASS=literal>false</tt> 
to disallow multiple selections. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Changes list peer's selection mode. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch23-REFSECT2-AUTOID.70">setMultipleSelections</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch23-REFSECT3-AUTOID.71">public abstract void setMultipleSelections (boolean value) <img src="gifs/wstar.gif" alt="(Deprecated)" border=0></A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>value</I><br>
<DD>

<P CLASS=para>
<tt CLASS=literal>true</tt> 
to allow multiple selections within the list's peer; <tt CLASS=literal>false</tt> 
to disallow multiple selections. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Changes list peer's selection mode. <tt CLASS=literal>Replaced by 
setMultipleMode(boolean)</tt>. </DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch23-REFSECT1-AUTOID.67">See Also</A></h2>

<P CLASS=para>
<tt CLASS=literal>ComponentPeer</tt>, <tt CLASS=literal>Dimension</tt>, 
<tt CLASS=literal>String</tt> 

</DIV>


<DIV CLASS=htmlnav>

<P>
<HR align=left width=515>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch23_13.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><a href="index.htm"><img src='gifs/txthome.gif' border=0 alt='Home'></a></td>
<td width=172 align=right valign=top><A HREF="ch23_15.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
<tr>
<td width=172 align=left valign=top>LightweightPeer <img src="gifs/bstar.gif" alt="(New)" border=0></td>
<td width=171 align=center valign=top><a href="index/idx_a.htm"><img src='gifs/index.gif' alt='Book Index' border=0></a></td>
<td width=172 align=right valign=top>MenuBarPeer</td>
</tr>
</table>
<hr align=left width=515>

<IMG SRC="gifs/smnavbar.gif" USEMAP="#map" BORDER=0> 
<MAP NAME="map"> 
<AREA SHAPE=RECT COORDS="0,0,108,15" HREF="../javanut/index.htm"
alt="Java in a Nutshell"> 
<AREA SHAPE=RECT COORDS="109,0,200,15" HREF="../langref/index.htm" 
alt="Java Language Reference"> 
<AREA SHAPE=RECT COORDS="203,0,290,15" HREF="../awt/index.htm" 
alt="Java AWT"> 
<AREA SHAPE=RECT COORDS="291,0,419,15" HREF="../fclass/index.htm" 
alt="Java Fundamental Classes"> 
<AREA SHAPE=RECT COORDS="421,0,514,15" HREF="../exp/index.htm" 
alt="Exploring Java"> 
</MAP>
</DIV>

</BODY>
</HTML>
